package Client;

import java.io.IOException;
import java.util.LinkedList;

public class BestEffortBroadcast {
	
	private LinkedList<PerfectPointToPointLink> clientsPl;
	private PerfectPointToPointLink plMe;
	private int numberOfProcess;
	
	//Constructor
	public BestEffortBroadcast(int myPort,int[] ports,String[] IPs) throws IOException {
		
		this.numberOfProcess = ports.length;
		//Connect with ALL
		clientsPl = new LinkedList<PerfectPointToPointLink>();
		
		//Myself to receive a message
		//plMe = new PerfectPointToPointLink("Server", myPort,null);
		
		//List of PerfectLinks for each Client
		for(int i =0; i< this.numberOfProcess; i++)
			;
			//clientsPl.add(new PerfectPointToPointLink("Client",ports[i],IPs[i]));
		
		// TODO Auto-generated constructor stub
	}
	
	//Send Values
	public void send(long value) throws Exception{
		System.out.print("Sending Beb Message:");
		System.out.println(value);
		for(int i = 0; i < clientsPl.size(); i++){
			//clientsPl.get(i).send(value);
		}
	}
	
	//Deliver a message from PL
	public long deliver() throws IOException{
		for(int i = 0; i < clientsPl.size(); i++)
			//return clientsPl.get(i).deliver();
			return 0;
		return -1;
	}
	
	//Close Connections
	public void closeConection() throws IOException{
		for(int i = 0; i < clientsPl.size(); i++)
			clientsPl.get(i).closeConection();
		
	}
	

}
